#include <iostream>
#include "rat.h"


/*
struct fraction
{
	int up;
	int down;
	
	
	fraction ( int a, int b )
	{ 
		up = a;
		down = b;
		if (down < 0)
			up = -up;
		simplify();
	}
	fraction ( int a )
	{
		up = a;
		down = 1;
	}

	fraction ( const fraction& t )
	{
		up = t.up;
		down = t.down;
	}


	void print ( ) const
	{
		std::cout << up << "/" << down << std::endl;
	}


	fraction& operator += ( const fraction& f1 )  // method   __reference
	{	
		up = up * f1.down + f1.up * down;
		down = down * f1.down;
		simplify();
		return *this;
	}
	

	fraction& operator -= ( const fraction& f1 )  // method   __reference
	{	
		up = up * f1.down - f1.up * down;
		down = down * f1.down;
		simplify();
		return *this;
	}
	
	fraction& operator /= ( const fraction& f1 )  // method   __reference
	{	
		up = up * f1.down;
		down = down * f1.up;	
		simplify();	
		return *this;
	}
	

	fraction& operator *= ( const fraction& f1 )  // method   __reference
	{	
		up = up * f1.up;
		down = down * f1.down;		
		simplify();
		return *this;
	}
	
	
	fraction& operator ++ ()
	{
		up = up + down;
		simplify();
		return *this;			
	}
	
	fraction operator ++ (int) 
	{
		fraction tmp (*this);
		up = up + down;
		simplify();
		return tmp;				
	}
	
	
	fraction& operator -- ()
	{
		up = up - down;
		simplify();
		return *this;			
	}
	
	fraction operator -- (int) 
	{
		fraction tmp (*this);
		up = up - down;
		simplify();
		return tmp;				
	}
		 
	operator double()
	{
		double p = up / down;
		return p;	
	}
	
	fraction operator- ()
	{
		fraction tmp ( *this );
		tmp.up = -tmp.up;
		return tmp;
	} 
	

	
	void simplify ()
	{
		int j;
		while ( ( j = GCD ( up , down ) ) != 1 )
		{
			up = up / j;
			down = down / j;
		}
	}
	
	int GCD ( int a , int b )
	{
		while ( a != 0 && b != 0 )
        {
			if ( a >= b ) a = a % b;
            else b = b % a;
        }
        return a + b;
	}
	
	
	
};


bool operator > ( const fraction& th , const fraction& t )
{
	if ( th.up * t.down > t.up * th.down ) 
		return true;
	return false;
}
	

bool operator < ( const fraction& th , const fraction& t )
{
	if ( th.up * t.down < t.up * th.down ) 
		return true;
	return false;
}



bool operator == ( const fraction& th , const fraction& t )
	{
		if (( th.up == t.up ) && ( th.down == t.down ))
			return true;
		return false;
	}



bool operator >= ( const fraction& th , const fraction& t )
{
	if (( th > t ) || ( th == t ))
		return true;
	return false;
}

bool operator <= ( const fraction& th , const fraction& t )
{
	if (( th < t ) || ( th == t ))
		return true;
	return false;
}



bool operator != ( const fraction& th , const fraction& t )
{
	if (( th.up != t.up ) || ( th.down != t.down ))
		return true;
	return false;
}


fraction operator + ( const fraction& f1, const fraction& f2)  // function
{
	fraction tmp(f1);
	tmp+=f2;
	return tmp;
}

fraction operator - ( const fraction& f1, const fraction& f2)  // function
{
	fraction tmp(f1);
	tmp-=f2;
	return tmp;
}

fraction operator * ( const fraction& f1, const fraction& f2)  // function
{
	fraction tmp(f1);
	tmp*=f2;
	return tmp;
}

fraction operator / ( const fraction& f1, const fraction& f2)  // function
{
	fraction tmp(f1);
	tmp/=f2;
	return tmp;
}
*/

int main()
{

	fraction a(2,7);
	fraction b(a);
	
	b=-a;
	
	
	
	a.print();
	b.print();
		
	//fraction c=a+=b;
	
	double q = a+=b;
	//= a+=b;
	
	//q = double (a+=b);
	
	//c.print();
	std::cout << q << std::endl;


	return 0;
}
